//
//  NetWorkingToolMv.m
//  CatMusic
//
//  Created by dllo on 15/5/6.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "NetWorkingToolMv.h"

@implementation NetWorkingToolMv


+ (void)netWorkingToolStr:(NSString *)strURL block:(Block)myBlock
    {
        NSString *strURLEncode = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:strURLEncode];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
            
            if (data != nil) {
                
                // 解析到的数据
                id result = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
                myBlock(result);    // 调用传过来的block
            }
            else
            {
                NSLog(@"4");
            }
        }];
}
    
    



@end
